﻿<info:BootstrapperApplication x:Class="XWord.GUI.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:info="http://schemas.xword.com/winfx/xaml/info" 
             xmlns:cal="http://www.caliburnproject.org">
    <info:BootstrapperApplication.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>

                <!--<ResourceDictionary Source="/XWord.GUI;Component/Resources/Controls/ListBox.xaml"/>-->
                <ResourceDictionary Source="/XWord.GUI;Component/Resources/Controls/Converter.xaml"/>
              
            </ResourceDictionary.MergedDictionaries>
            <!--<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.TextBoxKey}}" />
            <Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.PasswordBoxKey}}" />
            <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.ButtonKey}}"/>
            <Style TargetType="{x:Type RadioButton}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.RadioButtonKey}}"/>
            <Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.CheckBoxKey}}" />
            <Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.ComboBoxKey}}" />
            <Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.ScrollBarKey}}" />
            <Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.ToolTipKey}}" />
            <Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.ScrollViewerKey}}" />
            <Style TargetType="{x:Type Slider}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.StatusBarSliderKey}}" />
            <Style TargetType="{x:Type Expander}" BasedOn="{StaticResource {x:Static themes:NavigationBarCommonDictionary.ExpanderStyleKey}}" />
            
            <PathGeometry x:Key="TreeArrow">
                <PathGeometry.Figures>
                    <PathFigureCollection>
                        <PathFigure IsFilled="True"
										StartPoint="0 0"
										IsClosed="True">
                            <PathFigure.Segments>
                                <PathSegmentCollection>
                                    <LineSegment Point="0 6"/>
                                    <LineSegment Point="6 0"/>
                                </PathSegmentCollection>
                            </PathFigure.Segments>
                        </PathFigure>
                    </PathFigureCollection>
                </PathGeometry.Figures>
            </PathGeometry>


            <Style x:Key="ExpandCollapseToggleStyle"
				 TargetType="{x:Type ToggleButton}">
                <Setter Property="Focusable"
						Value="False"/>
                <Setter Property="Width"
						Value="16"/>
                <Setter Property="Height"
						Value="16"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Width="16"
									Height="16"
									Background="Transparent"
									Padding="5,5,5,5">
                                <Path x:Name="ExpandPath"
									Fill="Transparent"
									Stroke="#FF989898"
									Data="{StaticResource TreeArrow}">
                                    <Path.RenderTransform>
                                        <RotateTransform Angle="135"
																 CenterX="3"
																 CenterY="3"/>
                                    </Path.RenderTransform>
                                </Path>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver"
										 Value="True">
                                    <Setter TargetName="ExpandPath"
											Property="Stroke"
											Value="#FF1BBBFA"/>
                                    <Setter TargetName="ExpandPath"
											Property="Fill"
											Value="Transparent"/>
                                </Trigger>

                                <Trigger Property="IsChecked"
										 Value="True">
                                    <Setter TargetName="ExpandPath"
											Property="RenderTransform">
                                        <Setter.Value>
                                            <RotateTransform Angle="180"
																	 CenterX="3"
																	 CenterY="3"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter TargetName="ExpandPath"
											Property="Fill"
											Value="#FF595959"/>
                                    <Setter TargetName="ExpandPath"
											Property="Stroke"
											Value="#FF262626"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style
				 TargetType="{x:Type TreeViewItem}">
                <Setter Property="Background"
						Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment"
						Value="{Binding Path=HorizontalContentAlignment,RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                <Setter Property="VerticalContentAlignment"
						Value="{Binding Path=VerticalContentAlignment,RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                <Setter Property="Padding"
						Value="1,0,0,0"/>
                <Setter Property="Foreground"
						Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="TreeViewItem">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <ToggleButton x:Name="Expander"
													Style="{StaticResource ExpandCollapseToggleStyle}"
													IsChecked="{Binding Path=IsExpanded,RelativeSource={RelativeSource TemplatedParent}}"
													ClickMode="Press"/>
                                <Border Grid.Column="1"
                                    x:Name="OuterBorder" BorderThickness="1" CornerRadius="3" BorderBrush="Transparent" Background="Transparent">
                                    <Border x:Name="InnerBorder" BorderThickness="1" CornerRadius="2" BorderBrush="Transparent" Background="Transparent">
                                        <ContentPresenter x:Name="PART_Header"
																ContentSource="Header"
																HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
																SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

                                    </Border>
                                </Border>
                                <ItemsPresenter x:Name="ItemsHost" Margin="-5,0,0,0"
														Grid.Row="1"
														Grid.Column="1"
														Grid.ColumnSpan="2"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsExpanded"
										 Value="false">
                                    <Setter TargetName="ItemsHost"
											Property="Visibility"
											Value="Collapsed"/>
                                </Trigger>
                                
                                <Trigger Property="HasItems"
										 Value="false">
                                    <Setter TargetName="Expander"
											Property="Visibility"
											Value="Hidden"/>
                                </Trigger>
                                <Trigger SourceName="OuterBorder" Property="IsMouseOver" Value="True">
                                    <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlOuterBorderHoverBrushKey}}" />
                                    <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlLargeBackgroundHoverBrushKey}}" />
                                    <Setter TargetName="InnerBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlInnerBorderHoverBrushKey}}" />
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="True" />
                                        <Condition Property="IsMouseOver" Value="False" />
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlOuterBorderSelectedBrushKey}}" />
                                    <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlLargeBackgroundSelectedBrushKey}}" />
                                    <Setter TargetName="InnerBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlInnerBorderSelectedBrushKey}}" />
                                </MultiTrigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="True" />
                                        <Condition Property="IsMouseOver" Value="True" />
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlOuterBorderHoverSelectedBrushKey}}" />
                                    <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlLargeBackgroundHoverSelectedBrushKey}}" />
                                    <Setter TargetName="InnerBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlInnerBorderHoverSelectedBrushKey}}" />
                                </MultiTrigger>

                                <Trigger Property="IsEnabled"
										 Value="false">
                                    <Setter Property="Foreground"
											Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>-->
            <ContextMenu x:Key="TrayIconMenu">
                <MenuItem Header="打开" cal:Message.Attach="OpenMainWindow"/>
                <MenuItem Header="在线更新"/>
                <MenuItem Header="选项..." cal:Message.Attach="OpenOptionWindow"/>
                <MenuItem Header="关于 XWord" cal:Message.Attach="About"/>
                <MenuItem Header="退出" cal:Message.Attach="ShutDown"/>
            </ContextMenu>
        </ResourceDictionary>
    </info:BootstrapperApplication.Resources>
</info:BootstrapperApplication>
